package com.sailorj.medical.web.servlet;

import java.io.IOException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sailorj.medical.dao.Family_memberDAO;
import com.sailorj.medical.domain.family_member.Family_member;

public class FindServlet extends BaseServlet {
	private static final Logger LOG = LogManager.getLogger(FindServlet.class);
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		find(request, response);
	}

	private void find(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		LOG.info("来到了find()");
		// 1：接收参数
		String familycode = req.getParameter("id");
		// 2:构造新慢病信息对象
		Family_memberDAO model = new Family_memberDAO();
		try {
			List<Family_member> word = model.findFamilyList(familycode);
			write(word, req, resp);
			// process(req, resp, "/page/join_nh/join_nh_list.jsp");
		} catch (Exception e) {
			error(req, resp);
		}

	}
}
